#include <iostream>

using namespace std;

int a,b,cnt;
int day[]={0,31,29,31,30,31,30,31,31,30,31,30,31};

int main()
{
	cin >> a >> b;
	for(int i=1;i<=12;i++)
	{
		for(int j=1;j<=day[i];j++)
		{
			int num=j%10*1000+j/10*100+i%10*10+i/10;
			int l=num*10000+i*100+j;
			if(l>=a && l<=b) cnt++;
		}
	}
	cout << cnt;
	return 0;
}
